﻿<UserControl x:Class="MessengerSample.Page"
    xmlns="http://schemas.microsoft.com/client/2007" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:Messenger="clr-namespace:Microsoft.Live.Messenger;assembly=Microsoft.Live.Messenger"
    xmlns:MessengerUx="clr-namespace:MessengerSample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
   
	<UserControl.Resources>
        <MessengerUx:PresenceStatusToVisibilityConverter x:Key="StatusToVisibility" />
        <MessengerUx:PresenceStatusToIconConverter x:Key="StatusToIcon" />
        <MessengerUx:PresenceToFriendlyNameConverter x:Key="PresenceToFriendlyName" />
        <MessengerUx:PresenceToPersonalMessageConverter x:Key="PresenceToPersonalMessage" />
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot" Background="White">
        <ListBox Margin="0,0,0,0" x:Name="ContactList" Style="{StaticResource ContactList}" VerticalAlignment="Stretch" Width="400" Height="600" ItemsSource="{Binding Contacts, Mode=OneWay}" HorizontalAlignment="Left">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel MouseLeftButtonUp="OnContactSelected"
                                Orientation="Horizontal"
                                Visibility="{Binding CurrentAddress.Presence.Status, Converter={StaticResource StatusToVisibility}}">
                        <Image Width="16" Height="16" Source="{Binding CurrentAddress.Presence.Status, Converter={StaticResource StatusToIcon}}" />
                        <TextBlock Text="{Binding CurrentAddress.Presence, Converter={StaticResource PresenceToFriendlyName}}" />
                        <TextBlock Text="{Binding CurrentAddress.Presence, Converter={StaticResource PresenceToPersonalMessage}}" Foreground="LightGray" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

    </Grid>
</UserControl>
